﻿using System;

namespace GeneralDFS.Common
{
    public static class DateTimeExtension
    {
        /// <summary>
        /// 获取当前精确时间
        /// </summary>
        /// <returns>long类型</returns>
        public static long LongNow(this DateTime datetime)
        {
            return datetime.ToFileTime();
        }

        /// <summary>
        /// 获取标准DateTime类型时间
        /// </summary>
        /// <param name="time">FileTime</param>
        /// <returns>DateTime类型</returns>
        public static DateTime GetDateTime(long time)
        {
            return DateTime.FromFileTime(time);
        }
    }
}
